package com.facebank.usersupport.common;

public enum TravelSiteEnum {
    ShenZhenGuoLv(1,"szcits.cn");
    private int id;
    private String url;
    private TravelSiteEnum(int id, String url) {
        this.id = id;
        this.url = url;
    }

    public int getId() {
        return id;
    }

    public String getUrl() {
        return url;
    }

    public static TravelSiteEnum getEnumById(int id) {
        for (TravelSiteEnum novelSiteEnum : values()) {
            if (novelSiteEnum.getId() == id) {
                return novelSiteEnum;
            }
        }
        throw new RuntimeException("没有找到对应的枚举");
    }
    public static TravelSiteEnum getEnumByUrl(String url) {
        for (TravelSiteEnum novelSiteEnum : values()) {
            if (url.contains(novelSiteEnum.getUrl())) {
                return novelSiteEnum;
            }
        }
        throw new RuntimeException("没有找到对应的枚举");
    }
}
